// pages/recommendedPrizes/messageDetails/messageDetails.js
import util from '../../../utils/util.js';
import $ from '../../../utils/ajax.js';
const app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        optype: 1,
        ids: "",
        messageData: {}
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(option) {
        var that = this
        wx.getStorage({
            key: 'messageData',
            success: function(res) {
                const messageData = JSON.parse(res.data);
                that.setData({
                    messageData: messageData,
                    ids: messageData.id
                }, () => {
                    that.putIn();
                })
            }
        })
        wx.removeStorage({
            key: 'messageData',
            success(res) {
               
            }
        })

    },
    putIn() {
        $.p(app.wxApp.url + 'messagereceive/recBatchOp', {
            optype: this.data.optype,
            ids: this.data.ids
        }, app.onStrart, (res) => {

            app.onShop()

        }, (res) => {
            util.showToast(res.data)
        })
    },

})